import axios from '@/utils/myaxios.js';

// 文章列表
export const getPost = (params) => {
  return axios({
    url: '/post',
    params
  });
};

// 获得栏目列表
export const category = () => {
  return axios({
    url: '/category'
  });
};

// 发表文章
export const sendPost = (data) => {
  return axios({
    method: 'post',
    url: '/post',
    data
  });
};

// 文章详情
export const postData = id => {
  return axios({
    url: `/post/${id}`
  });
};

// 编辑文章
export const editPost = (id, data) => {
  return axios({
    method: 'post',
    url: `/post_update/${id}`,
    data
  });
};